# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=nasm
pkgver=2.13.03
pkgrel=1
pkgdesc="An 80x86 assembler designed for portability and modularity"
arch=('i686' 'x86_64')
url="http://www.nasm.us"
license=('BSD')
makedepends=('perl-Font-TTF' 'perl-Sort-Versions' 'mingw-w64-i686-fontconfig' 'mingw-w64-i686-ghostscript')
depends=('msys2-runtime')
#install=nasm.install
source=("http://www.nasm.us/pub/nasm/releasebuilds/${pkgver}/${pkgname}-${pkgver}.tar.xz"
        "Arial.ttf"
        "Arial-Bold.ttf"
        "Arial-Italic.ttf"
        "Arial-BoldItalic.ttf"
        "SourceCodePro-Bold.ttf"
        "SourceCodePro-Regular.ttf"
        "SourceCodePro-Semibold.ttf")
sha256sums=('812ecfb0dcbc5bd409aaa8f61c7de94c5b8752a7b00c632883d15b2ed6452573'
            '830bdfbfc031193a8272080a7ae3c8921955ec2fa8ac51783c3d249a511c7b6b'
            '4bf078af9e7623e99d16f08d3bf5444b1f0d14eb880ff38aab891b6fb2b8c5af'
            'dfc292434458f74eb94c66d25a28bd583a109c63dedec79c24091ad71f98eac1'
            '1bcea429a82db167593ba80b14ad8d938c442bfc5728e5956abb019b22262fb9'
            'd34d3d1b65839073a1ba620a9971f209ab3288c3e71ae8115102f980d596cb2b'
            '5d825dc834fa28619fea5d80ab68a75c142a9341657304a21911b34161d64ec8'
            'adba8131a6df7d32c158c9e21df100fc6f4a65bbebcdb8bee0f1b8ef5674dd11')

fonts=( "Arial.ttf"
        "Arial-Bold.ttf"
        "Arial-Italic.ttf"
        "Arial-BoldItalic.ttf"
        "SourceCodePro-Bold.ttf"
        "SourceCodePro-Regular.ttf"
        "SourceCodePro-Semibold.ttf")

prepare() {
  local f

  [ -d ~/.fonts/ ] || mkdir -pv ~/.fonts/

  for f in ${fonts[@]}; do
    [ -f ~/.fonts/${f} ] || cp -vf ${srcdir}/${f} ~/.fonts/
  done
}

build() {
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr
  make all -j1
  
  export PATH=${PATH}:/mingw32/bin
  #make -C doc
}

package() {
  cd ${pkgname}-${pkgver}
  make INSTALLROOT="${pkgdir}" install #install_rdf
  install -D -m644 LICENSE "${pkgdir}"/usr/share/licenses/nasm/LICENSE
}
